package kr.ac.kongju.gedl.cmmn.tag;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import kr.ac.kongju.gedl.cmmn.menu.MenuLevelVO;
import kr.ac.kongju.gedl.cmmn.menu.MenuManager;
import kr.ac.kongju.gedl.cmmn.web.CU;
import kr.ac.kongju.gedl.code.vo.CodeInfoVO;

import org.apache.commons.lang.StringUtils;


public class TopMenuTag extends TagSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = -9200870389322778179L;
	
	private String menuId;
	



	public String getMenuId() {
		return menuId;
	}




	public void setMenuId(String menuId) {
		this.menuId = menuId;
	}




	public int doStartTag() throws JspException {
		try {
			String context = pageContext.getServletContext().getContextPath();
			String url = ((HttpServletRequest)pageContext.getRequest()).getAttribute("javax.servlet.forward.request_uri").toString();
			String query = ((HttpServletRequest)pageContext.getRequest()).getQueryString();
			
			JspWriter jw = pageContext.getOut();
            StringBuffer sb = new StringBuffer();
            
            List<CodeInfoVO> regionList1 = CU.getInstance().getCodeList("REGION");
            
            //sb.append("<ul class='lnb_menu'>");
    		for(CodeInfoVO codeInfo : regionList1) {
    			sb.append("<li><a href=\"/item/areaService.do?areaCd="+codeInfo.getCodeId()+"\" >"+codeInfo.getCodeName()+"</a></li>\n");
    		}
    		 //sb.append("</ul>");
    		jw.print(sb.toString());
    		
        } catch (Exception ex) {
            throw new JspTagException(ex.getMessage());
        }
                
        return SKIP_BODY; 
	}
	
}
